﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace Reverse
{
    class reverse
    {
       
        static void Main(string[] args)
        {
            Stopwatch st = new Stopwatch();
            st.Start();
            Console.WriteLine("input string reverse: ");
            string ten = Console.ReadLine();
            char[] mangreverse = ten.ToCharArray();
            int start = 0;
            int end = mangreverse.Length - 1;
            char tmp;
            while(start <= end)
            {
                tmp = mangreverse[start];
                mangreverse[start] = mangreverse[end];
                mangreverse[end] = tmp;
                start++;
                end--;
            }
            Console.WriteLine("output reverse: ");
            for(int i = 0 ; i < mangreverse.Length ;i++)
            {
                Console.Write(mangreverse[i]);
            }
            Console.WriteLine();

            st.Stop();
            var count = ten.Count(x => x == 'n');
            //var count = text.TakeWhile(c => c == '$').Count();
            //int count = yourText.Length - yourText.TrimStart('$').Length;
            Console.WriteLine(count.ToString());
            

        }
    }
}
